//
//  GGZFBBusinessCollectionViewCell.m
//  Gunterapple
//
//  Created by 热带雨林 on 2020/3/31.
//  Copyright © 2020 热带雨林. All rights reserved.
//

#import "GGZFBBusinessCollectionViewCell.h"
#import "ZFBBusinessTypeModel.h"
#import <Masonry.h>
@interface GGZFBBusinessCollectionViewCell ()
@property (nonatomic, weak) UIImageView *iconImag;
@property (nonatomic,weak) UILabel *nameLabel;
@end

@implementation GGZFBBusinessCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI{
    self.backgroundColor = [UIColor whiteColor];
    UIImageView *iconImag = [[UIImageView alloc]initWithFrame:CGRectZero];
    [self.contentView addSubview:iconImag];
    self.iconImag = iconImag;
    
    UILabel *nameLabel = [[UILabel alloc]init];
    [self.contentView addSubview:nameLabel];
    [nameLabel sizeToFit];
    nameLabel.font = [UIFont systemFontOfSize:12];
    self.nameLabel = nameLabel;
    
    [iconImag mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(27, 27));
        make.centerX.equalTo(self.contentView);
        make.top.equalTo(self.contentView).offset(10);
    }];
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(iconImag);
        make.top.equalTo(iconImag.mas_bottom).offset(9);
    }];
}
- (void)setModel:(ZFBBusinessTypeModel *)model{
    _model = model;
    self.iconImag.image = [UIImage imageNamed:model.icon];
    self.nameLabel.text = model.name;
}

@end
